package com.ht.base.system.biz.client.impl;

import com.ht.base.system.biz.manager.SysDeptManager;
import com.ht.base.system.client.SysDeptClient;
import com.ht.base.system.common.pojo.bo.SysDeptBO;
import com.ht.base.system.common.pojo.qto.SysDeptQTO;
import com.ht.base.system.common.pojo.vo.TreeSelect;
import org.base.common.appexception.AppException;
import org.base.common.appexception.ResultData;
import org.base.common.page.PageBO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author hdengxian
 * @Date 2023/8/15 17:08
 */
@DubboService
@Component
public class SysDeptClientImpl implements SysDeptClient {
    @Resource
    private SysDeptManager sysDeptManager;

    @Override
    public ResultData<Boolean> saveDept(SysDeptBO dept) throws AppException {
        return new ResultData<>(sysDeptManager.saveDept(dept));
    }

    @Override
    public ResultData<Boolean> updateDept(SysDeptBO dept) throws AppException {
        return new ResultData<>(sysDeptManager.updateDept(dept));
    }

    @Override
    public ResultData<Boolean> delDept(Long sysDeptId) throws AppException {
        return new ResultData<>(sysDeptManager.delDept(sysDeptId));
    }

    @Override
    public ResultData<SysDeptBO> findDeptById(Long sysDeptId) throws AppException {
        return new ResultData<>(sysDeptManager.findDeptById(sysDeptId));
    }

    @Override
    public ResultData<PageBO<SysDeptBO>> findDeptForPage(SysDeptQTO qto) throws AppException {
        return new ResultData<>(sysDeptManager.findDeptForPage(qto));
    }

    @Override
    public ResultData<List<SysDeptBO>> findSysDeptList(SysDeptQTO qto) throws AppException {
        return new ResultData<>(sysDeptManager.findSysDeptList(qto));
    }

    @Override
    public ResultData<List<SysDeptBO>> buildDeptTree(List<SysDeptBO> deptList) throws AppException {
        return new ResultData<>(sysDeptManager.buildDeptTree(deptList));
    }

    @Override
    public ResultData<List<TreeSelect>> buildTreeSelect(List<SysDeptBO> deptTree) throws AppException {
        return new ResultData<>(sysDeptManager.buildTreeSelect(deptTree));
    }
}
